package com.yxinsur.imc.business.enums;

import com.yxinsur.imc.common.utils.StringUtils;
import lombok.Getter;

@Getter
public enum EducationEnum {
    A("10|博士后","博士后"),
    B("20|博士","博士"),
    C("30|硕士","硕士"),
    D("40|本科","本科"),
    E("50|专科","专科"),
    F("60|中专","中专"),
    G("70|高中","高中"),
    H("80|初中","初中"),
    I("90|小学","小学"),
    J("91|文盲","文盲"),
    K("99|其他","其他");

    private String keyNames;

    private String keyName;

    private EducationEnum(String keyNames, String keyName) {
        this.keyNames = keyNames;
        this.keyName = keyName;
    }

    public String getKeyNames() {
        return keyNames;
    }

    public String getKeyName() {
        return keyName;
    }

    public static String getValueByKeyName(String keyName) {
        String keyValue = null;
        if (StringUtils.isNotBlank(keyName)) {
            for (PapersType c : PapersType.values()) {
                if (c.getKeyNames().contains(keyName)) {
                    keyValue = c.name();
                    break;
                }
            }
        }
        return keyValue;
    }

    public static String getKeyNameByValue(String value) {
        String keyValue = null;
        if (StringUtils.isNotBlank(value)) {
            for (PapersType c : PapersType.values()) {
                if (c.getKeyNames().contains(value)) {
                    keyValue = c.getKeyName();
                }
            }
        }
        return keyValue;
    }
}
